/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.yogi.webframework.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Yogi
 */
@Entity
@Table(name = "t_config_category")
@NamedQueries({
    @NamedQuery(name = "ConfigCategory.findAll", query = "SELECT c FROM ConfigCategory c"),
    @NamedQuery(name = "ConfigCategory.findById", query = "SELECT c FROM ConfigCategory c WHERE c.id = :id"),
    @NamedQuery(name = "ConfigCategory.findByCategory", query = "SELECT c FROM ConfigCategory c WHERE c.category = :category")})
public class ConfigCategory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "CATEGORY")
    private String category;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "configCategory")
    private List<Config> configList;

    public ConfigCategory() {
    }

    public ConfigCategory(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public List<Config> getConfigList() {
        return configList;
    }

    public void setConfigList(List<Config> configList) {
        this.configList = configList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ConfigCategory)) {
            return false;
        }
        ConfigCategory other = (ConfigCategory) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.yogi.webframework.model.ConfigCategory[id=" + id + "]";
    }

}
